package cn.iocoder.yudao.module.train.dal.mysql.coursegroup;

import java.util.*;

import cn.iocoder.yudao.framework.common.pojo.PageResult;
import cn.iocoder.yudao.framework.mybatis.core.query.LambdaQueryWrapperX;
import cn.iocoder.yudao.framework.mybatis.core.mapper.BaseMapperX;
import cn.iocoder.yudao.module.train.dal.dataobject.coursegroup.CourseGroupDO;
import org.apache.ibatis.annotations.Mapper;
import cn.iocoder.yudao.module.train.controller.admin.coursegroup.vo.*;

/**
 * 课程组管理 Mapper
 *
 * @author waynelam
 */
@Mapper
public interface CourseGroupMapper extends BaseMapperX<CourseGroupDO> {

    default PageResult<CourseGroupDO> selectPage(CourseGroupPageReqVO reqVO) {
        return selectPage(reqVO, new LambdaQueryWrapperX<CourseGroupDO>()
                .likeIfPresent(CourseGroupDO::getName, reqVO.getName())
                .eqIfPresent(CourseGroupDO::getCoverUrl, reqVO.getCoverUrl())
                .likeIfPresent(CourseGroupDO::getGroupIntro, reqVO.getGroupIntro())
                .eqIfPresent(CourseGroupDO::getGroupSort, reqVO.getGroupSort())
                .betweenIfPresent(CourseGroupDO::getCreateTime, reqVO.getCreateTime())
                .orderByDesc(CourseGroupDO::getId));
    }


}
